'use strict';

const Controller = require('egg').Controller;

class InfoController extends Controller {
  async get() {
    const  ctx  = this.ctx;
    const result = await ctx.service.public.getall('table_info',ctx.params.httpid)
    ctx.body = result;
  }
  async post() {
    const  ctx  = this.ctx;
    const result = await ctx.service.public.add('table_info',ctx.query)
    ctx.body = result;
  }
  async put() {
    const  ctx  = this.ctx;
    const result = await ctx.service.public.update('table_info',ctx.query)
    ctx.body = result;
  }
  async delete() {
    const  ctx  = this.ctx;
    const result = await ctx.service.public.delete('table_info',ctx.query)
    ctx.body = result;
  }
  async getapi(){
    const  ctx  = this.ctx;
    let str = ctx.request.headers.origin
    const url = str.slice(str.lastIndexOf('/')+1)
    const uu = await ctx.service.public.geta('table_info',url)
    ctx.body = uu; 
  }
}

module.exports = InfoController;
